<template>
	<view class="l_pages">
		<jnavbar title="发票中心"></jnavbar>
		<scroll-view class="page_container tab_page_container" scroll-y>
			<view class="content">
				<view class="content-box mg220 ">
					<view class="box borb">
						<view class="box-left">
							<span class="box-icon">
								<u-icon name="red-packet-fill"></u-icon>
							</span>
							<span class="box-title">我的抬头</span>
						</view>
						<view class="box-right" @click="todetail()">
							<span>全部抬头</span>
							<u-icon name="arrow-right"></u-icon>
						</view>
					</view>
					<view class="box">
						<view class="box-name">
							<span>{{invoiceList.rise}}</span>
							<span class="box-sign">默认</span>
						</view>
					</view>
				</view>
				<view class="content-box mg20">
					<view class="box borb">
						<view class="box-name">
							<span>我的发票</span>
						</view>
					</view>
					<view class="box" style="justify-content: space-around;">
						<view @click="toMyInvoice(1)">
							<view class="box-icon">
								<u-icon name="order"></u-icon>
							</view>
							<view class="box-title">个人发票</view>
						</view>
						<view @click="toMyInvoice(2)">
							<view class="box-icon" style="background: #EEF6FF; color: #1577FF;">
								<u-icon name="file-text"></u-icon>
							</view>
							<view class="box-title">企业发票</view>
						</view>
						<view @click="toMyInvoice(0)">
							<view class="box-icon" style="background: #FFEBE3; color: #FF632F;">
								<u-icon name="grid-fill"></u-icon>
							</view>
							<view class="box-title">全部</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import {getisInvoice} from '@/common/invoice.js'
	import http from '@/common/http.js';
	export default {
		data() {
			return {
				invoiceList: {}
			}
		},
		async onLoad(e) {
			await this.$getWx
			this.id = e.id
			this.getInvoice();
		},
		methods: {
			todetail() {
				this.Jumpurl({
					link:'./invoice?id=' + this.id,
					type:1,
					login_type:2
					
				})
			},
			toMyInvoice(oNam) {
				this.Jumpurl({
					link: './myinvoice?invoice_type=' + oNam,
					type:1,
					login_type:2
				});
			},
			// 获取默认抬头
			getInvoice() {
				http('/invoice/riseRead', 'GET').then(res => {
					this.invoiceList = res.data.msg
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		min-height: 370rpx;
		width: 100%;
		background-image: url('https://jzwl365.oss-cn-beijing.aliyuncs.com/static/images/invoice-bar.png');
		background-repeat: no-repeat;
		background-size: 100%;
		padding: 25rpx;

		.content-box {
			border-radius: 20rpx;
			width: 100%;
			background: #FFFFFF;
			overflow: hidden;
			padding: 0 25rpx;

			.box {
				padding: 25rpx 0;
				display: flex;
				justify-content: space-between;
				align-items: center;
				color: #333;

				.box-left {
					display: flex;
					align-items: center;

					.box-icon {
						width: 50rpx;
						height: 50rpx;
						text-align: center;
						display: block;
						border-radius: 50%;
						background: linear-gradient(#E4552A, #F0943F);
						color: #FFFFFF;
						line-height: 36rpx;

						.u-icon {
							font-size: 32rpx;
						}
					}

					.box-title {
						margin-left: 20rpx;
						font-size: 32rpx;
						margin-top: 0;
					}
				}

				.box-right {
					color: #999999;
					font-size: 24rpx;
				}

				.box-name {
					font-size: 32rpx;
					font-weight: bold;
					color: #333;

					.box-sign {
						font-weight: normal;
						color: #E5582B;
						font-size: 18rpx;
						padding: 5rpx;
						border: solid #E55C2C 1px;
						border-radius: 8rpx;
						margin-left: 20rpx;
					}
				}

				.box-icon {
					text-align: center;
					width: 80rpx;
					height: 80rpx;
					line-height: 78rpx;
					border-radius: 50%;
					background: #FEF2E7;
					color: #F5AC48;
					font-size: 50rpx;
					margin: auto;
				}

				.box-title {
					margin-top: 10rpx;
					text-align: center;
				}
			}

		}
	}

	.mg220 {
		margin-top: 220rpx;
	}

	.mg20 {
		margin-top: 20rpx;
	}

	.borb {
		border-bottom: 1rpx solid #e8e8e8;
	}
</style>
